home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / applications / wp / ged11.lha / Install / data / main / GoldED / API / include / golded.h
C/C++ Source or Header  |  1994-08-12  |  13KB  |  244 lines

  1. #ifndef GOLDED_API_H
  2. #define GOLDED_API_H
  3. /*
  4. **      $Filename: fd/GoldED.h
  5. **      $Release: 2.0
  6. **      $Revision: 37.5
  7. **
  8. **      GoldED API definitions. This is a preliminary version; suggestions
  9. **      welcome.
  10. **
  11. **      Définitions API de GoldED. Ceci est une version préliminaire; des
  12. **      suggestions sont bienvenues.
  13. **
  14. **      (C) Copyright 1994 Dietmar Eilert
  15. **      All Rights Reserved · Tous Droits Réservés
  16. */
  17.  
  18. #ifndef EXEC_TYPES_H
  19. #include <exec/types.h>
  20. #endif
  21.  
  22. #ifndef EXEC_LISTS_H
  23. #include <exec/lists.h>
  24. #endif
  25.  
  26. #ifndef EXEC_LISTS_H
  27. #include <exec/lists.h>
  28. #endif
  29.  
  30. #ifndef INTUITION_INTUITION_H
  31. #include <intuition/intuition.h>
  32. #endif
  33.  
  34. #ifndef UTILITY_TAGITEM_H
  35. #include <utility/tagitem>
  36. #endif
  37.  
  38. #ifndef WORKBENCH_WORKBENCH_H
  39. #include <workbench/workbench.h>
  40. #endif
  41.  
  42. /* Basic peferences of current text · Préférences de base du texte actuel */
  43.  
  44. struct EditConfig {
  45.  
  46.     struct Node               Node;                  /* it's a linked list */
  47.     ULONG                     Magic;                 /* magic number */
  48.     struct LineNode          *TextNodes;             /* pointer to node of 1st line */
  49.     ULONG                     Lines;                 /* number of lines    (abs) */
  50.     ULONG                     TopLine;               /* 1st visible line   (abs) */
  51.     UWORD                     TopColumn;             /* 1st visible column (abs) */
  52.     UWORD                     Column;                /* cursor x position (abs) */
  53.     ULONG                     Line;                  /* current line number */
  54.     UWORD                     LastChangeColumn;      /* column of last change */
  55.     ULONG                     LastChangeLine;        /* line of last change */
  56.     ULONG                     MaxLines;              /* size of line ptr array */
  57.     char                      Path[141];             /* document's directory */
  58.     char                      Name[141];             /* document's name */
  59.     UBYTE                     Current[1000];         /* line buffer of current line */
  60.     UWORD                     CurrentLen;            /* bytes in buffer */
  61.     char                      UndoBuf[1000];         /* undo buffer */
  62.     UWORD                     UndoLen;               /* bytes in undo buffer */
  63.     ULONG                     UndoLine;              /* line number of undo buffer */
  64.     BOOL                      LineModified;          /* flag: line has changed */
  65.     BOOL                      DocModified;           /* document-modified flag */
  66.     UWORD                     BlockStartX;           /* block start (column) */
  67.     ULONG                     BlockStartY;           /* block start (line) */
  68.     ULONG                     BlockEndX;             /* block end   (column) */
  69.     ULONG                     BlockEndY;             /* block end   (line) */
  70.     BOOL                      Marker;                /* marker-used flag */
  71.     ULONG                     SearchLine;            /* start line for find */
  72.     UWORD                     SearchColumn;          /* start column for find */
  73.     long                      Protection;            /* file's protection bits */
  74.     BOOL                      Folds;                 /* any folds ? */
  75.     BOOL                      LineNotFixed;          /* line-may-be-changed flag */
  76.     BOOL                      ReadOnly;              /* disable save ? */
  77.     char                      Comment[80];           /* file comment */
  78.     UWORD                     BackupCounter;         /* AutoBackup counter [min] */
  79.     BOOL                      ValidName;             /* file named ? */
  80.  
  81.     /* private stuff follows · des choses privées suivent */
  82. };
  83.  
  84. /* each line of a text has an associated line node, describing the line contents */
  85. /* chaque ligne de texte possède un node de ligne associée, décrivant le contenu de la ligne */
  86.  
  87. struct LineNode {
  88.  
  89.     UWORD            Len;                            /* line's length */
  90.     char            *Text;                           /* pointer to text data */
  91.     struct Fold     *Fold;                           /* pointer to folded sub block */
  92. };
  93.  
  94. /* each subblock of folded lines has a fold root · chaque sous-bloc de lignes pliées possède une racine de pli: */
  95.  
  96. struct Fold {
  97.  
  98.     ULONG            Lines;                          /* lines within folded block */
  99.     struct LineNode *TextNodes;                      /* pointer to node of 1st line */
  100. };
  101.  
  102. /* Basic preferences of current window · Préférences de base de la fenêtre actuelle */
  103.  
  104. struct WindowSupportInfo {
  105.  
  106.     struct Node               Node;                  /* it's a linked list */
  107.     struct Window             *Window;               /* associated window */
  108.     struct EditConfig         *EditConfig;           /* text buffer (if any) */
  109.     UWORD                     Sleep;                 /* >0: show busy pointer */
  110.     struct Menu               *Menu;                 /* menu bar (if any) */
  111.     struct Gadget             *GadgetList;           /* pointer to 1st gadget (if any) */
  112.     void                      *(*CleanUp)(void);     /* window's cleanUp function */
  113.     void                      *(*Server)(void);      /* window's handler */
  114.     void                      *(*CallBack)(APTR);    /* all purpose callback function */
  115.     APTR                      Data;                  /* ptr to variables */
  116.     ULONG                     DataSize;              /* size of variables */
  117.     ULONG                     Mode;                  /* all purpose buffer */
  118.     LONG                      Buffer;                /* all purpose buffer */
  119.     UWORD                     Type;                  /* window/server type (1 = text window) */
  120.     UWORD                     ExitGadget;            /* gadget to be used on ESC */
  121.     UWORD                     Left;                  /* window dimensions */
  122.     UWORD                     Top;                   /* window dimensions */
  123.     UWORD                     Width;                 /* window dimensions */
  124.     UWORD                     Height;                /* window dimensions */
  125.  
  126.     /* private stuff follows · des choses privées suivent */
  127. };
  128.  
  129. /*
  130.   
  131.  API messages  are  sent  from  GoldED  to  clients.  API  messages  are  linked
  132.  (api_Next;  may  be  NULL).  The client has to check the api_State field before
  133.  processing the message (must be API_STATE_NOTIFY). Check the api_Class field to
  134.  determine  the  basic  message  type  (e.g.  API_CLASS_SCREEN if the message is
  135.  related to screen handling). Check the api_Action field to determine the actual
  136.  command  (e.g.  API_ACTION_HIDE if GoldED wants you to close your windows). The
  137.  client will always recieve a pointer to basic configuration data of the current
  138.  text (api_Config) and of the current window (api_WinInfo). Some classes provide
  139.  additional data using the api_Data field. After having  processed  the  message
  140.  you should update the api_Error field.
  141.  
  142.  Les messages API sont envoyés de GoldED vers les clients. Les messages API sont
  143.  liés  (api_Next;  peut  être  NULL). Le client doit vérifier le champ api_State
  144.  avant de traiter le message (doit être  API_STATE_NOTIFY).  Vérifiez  le  champ
  145.  api_Class  pour  déterminer le type de message de base (ex: API_CLASS_SCREEN si
  146.  le message se rapporte à la gestion d'écran). Vérifiez le champ api_Action pour
  147.  déterminer  la  commande  actuelle (ex: API_ACTION_HIDE si GoldED veut que vous
  148.  refermiez vos fenêtres). Le client recevra toujours un pointeur sur les données
  149.  de  base  de  la  configuration  du  texte actuel (api_Config) et de la fenêtre
  150.  actuelle   (api_WinInfo).   Certaines   classes   fournissent    des    données
  151.  supplémentaires  en utilisant le champ api_Data. Après avoir traité le message,
  152.  vous devriez mettre à jour le champ api_Error.
  153.  
  154. */
  155.  
  156. struct APIMessage {
  157.  
  158.     struct Message            api_Message;           /* embedded message structure         */
  159.     ULONG                     api_State;             /* message state (valid/invalid)      */
  160.     struct APIMessage        *api_Next;              /* next APIMessage                    */
  161.     struct EditConfig        *api_Config;            /* preferences of current text        */
  162.     struct WindowSupportInfo *api_WinInfo;           /* preferences of current window      */
  163.     char                     *api_Screen;            /* screen name                        */
  164.     ULONG                     api_Class;             /* notify class (see below)           */
  165.     ULONG                     api_Action;            /* notify code  (see below)           */
  166.     ULONG                     api_Qualifier;         /* intuition qualifier                */
  167.     APTR                      api_Data;              /* usage depends on api_Class         */
  168.     ULONG                     api_Error;             /* client's return code (see below)   */
  169.     ULONG                     api_Refresh;           /* display refresh request            */
  170.     BOOL                     *api_User;              /* pointer to array of user variables */
  171. };
  172.  
  173. /* ARexx notify structure passed to clients (see API_ACTION_COMMAND below) */
  174. /* Structure de notification ARexx passée aux clients (voir API_ACTION_COMMAND plus bas) */
  175.  
  176. struct APIRexxNotify {
  177.  
  178.     char                     *arn_Command;           /* command string passed to client (read-only), command part uppercase */
  179.     LONG                      arn_RC;                /* client's primary return code */
  180.     char                     *arn_CommandResult;     /* command result string (referenced, not copied by GoldED) */
  181.     char                     *arn_CommandError;      /* command error  string (referenced, not copied by GoldED) */
  182. };
  183.  
  184. /* Notify classes. Clients will recieve only those classes they've asked for */
  185. /* Classes de notification. Les clients recevront seulement les classes qu'ils demanderont */
  186.  
  187. #define API_CLASS_ROOT       (1L<<0)                 /* must be supported by all clients */
  188. #define API_CLASS_SCREEN     (1L<<1)                 /* screen handling (open/close) */
  189. #define API_CLASS_KEY        (1L<<2)                 /* keyboard events */
  190. #define API_CLASS_REXX       (1L<<3)                 /* ARexx commands */
  191.  
  192. /* supported refresh types (api_Refresh) */
  193. /* types de rafraîchissement gérés (api_Refresh) */
  194.  
  195. #define API_REFRESH_LINE     (1L<<1)                 /* make GoldED redraw current line */
  196. #define API_REFRESH_DISPLAY  (1L<<2)                 /* make GoldED redraw the current text */
  197. #define API_REFRESH_SYNC     (1L<<3)                 /* adjust view according to cursor position (redraw if necessary) */
  198.  
  199. /* Supported api_Action values for API_CLASS_ROOT */
  200. /* Valeurs api_Action supportées par API_CLASS_ROOT */
  201.  
  202. #define API_ACTION_NOP        0                      /* no operation */
  203. #define API_ACTION_DIE        1                      /* close your windows (before replying message) & quit */
  204. #define API_ACTION_CONFIG     2                      /* open your preferences requester */
  205. #define API_ACTION_INTRODUCE  3                      /* return (static) tag list describing your client */
  206.  
  207. /* API_ACTION_INTRODUCE tags */
  208. /* tags API_ACTION_INTRODUCE */
  209.  
  210. #define API_Client_Name       (TAG_USER + 1)         /* ti_Data pointing to client's name (UBYTE *) */
  211. #define API_Client_Copyright  (TAG_USER + 2)         /* ti_Data pointing to copyright string  (UBYTE *) */
  212. #define API_Client_Purpose    (TAG_USER + 3)         /* ti_Data pointing to short description of client (UBYTE *) */
  213. #define API_Client_Template   (TAG_USER + 4)         /* ti_Data pointing to a command template (UBYTE *); multiple use allowed */
  214.  
  215. /* Supported api_Action values for API_CLASS_KEY */
  216. /* Valeurs api_Action supportées pour API_CLASS_KEY */
  217.  
  218. #define API_ACTION_VANILLAKEY 1                      /* vanillakey event; key code passed in api_Data */
  219.  
  220. /* Supported api_Action values for API_CLASS_SCREEN */
  221. /* Valeurs api_Action supportées pour API_CLASS_SCREEN */
  222.  
  223. #define API_ACTION_HIDE       1                      /* close your windows (before replying message) */
  224. #define API_ACTION_SHOW       2                      /* open your windows (except config windows) */
  225.  
  226. /* Supported api_Action values for API_CLASS_REXX */
  227. /* Valeurs api_Action supportées pour API_CLASS_REXX */
  228.  
  229. #define API_ACTION_COMMAND    1                      /* internal/ARexx command passed to client (pointer to APIRexxNotify in api_Data) */
  230.  
  231. /* Supported api_Error values · Valeurs api_Error supportées */
  232.  
  233. #define API_ERROR_OK          0                      /* notify successfully processed */
  234. #define API_ERROR_FAIL        1                      /* processing of notify failed */
  235. #define API_ERROR_UNKNOWN     2                      /* unknown api_Code/api_Class detected */
  236.  
  237. /* Supported api_State values · Valeurs api_State générées */
  238.  
  239. #define API_STATE_IGNORE      0                      /* this messages should be ignored */
  240. #define API_STATE_NOTIFY      1                      /* this is a standard notify message */
  241. #define API_STATE_CONSUMED    2                      /* message consumed; won't be passed to other clients, no further processing by GoldED */
  242.  
  243. #endif
  244.